<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<HTML>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="${ pageContext.request.contextPath }/css/goodstype.css" />
<link href="${pageContext.request.contextPath}/css/Style1.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="${ pageContext.request.contextPath }/static/js/jquery-2.1.1.min.js"></script>
<!-- 引入样式 -->
<link
	href="${ pageContext.request.contextPath }/static/bootstrap-3.3.7-dist/css/bootstrap.min.css"
	rel="stylesheet">
<script type="text/javascript"
	src="${ pageContext.request.contextPath }/js/goodstype.js"></script>
<script type="text/javascript">
		 function addCategorySecond(){
			window.location.href = "${pageContext.request.contextPath}/admin/adminCategorySecond_addPage.action";
		} 
		function edit(csid) {
			window.location.href = "${pageContext.request.contextPath}/admin/adminCategorySecond_edit.action?csid="+csid;
		}
		function deletec(csid) {
			var r=confirm("确定删除吗？");
			
			if (r==true){
				window.location.href ="${pageContext.request.contextPath}/admin/adminCategorySecond_delete.action?csid="+csid;
				alert("删除成功！");
			}
			else{
			}
		}
</script>
</head>
<body>

	<div style="padding-top: 10px;">
	
		<div align="right" style="padding-right: 60px;">
			<input type="button" class="btn btn-primary Edit_btn" value="+二级种类"
				onclick="addCategorySecond()" />
		</div>
	</div>

	<div style="width: 96%; margin-left: 26px;">
		<form style="margin-top: 7px;" id="Form1" name="Form1">
			<table width="100%" align="center" id="table"
				class="table table-hover table-bordered table-striped">
				<thead>
					<tr align="center" bgcolor="#93b6bd" height="35">
						<th scope="col" width="30%" style="text-align: center;">种类ID</th>
						<th scope="col" width="30%" style="text-align: center;">二级分类名称</th>
						<th scope="col" style="text-align: center;">操作</th>
					</tr>
				</thead>
				<tbody></tbody>
				<!-- 循环遍历 -->
				<c:forEach items="${csPageBean.list}" var="cs" varStatus="status">
					<tr align="center">
						<td>${cs.csid}</td>
						<td>${cs.csname}</td> 
						<td><button type="button" class="btn btn-primary btn-sm glyphicon glyphicon-pencil"
								onclick="edit(${cs.csid})"></button>&nbsp;&nbsp;&nbsp;&nbsp;
							<button type="button" class="btn btn-danger btn-sm glyphicon glyphicon-trash"
								onclick="deletec(${cs.csid})"></button></td>
					</tr>
				</c:forEach>
			</table>
		</form>
	</div>

	<div align="right" style="margin-right: 60px; margin-bottom: 20px;">
		第 ${csPageBean.page }/${csPageBean.totlePage}页
		<c:if test="${csPageBean.page!= 1}">
			<a
				href="${pageContext.request.contextPath }/admin/adminCategorySecond_findAllByPage.action?page=1">首页</a>|
			     	<a
				href="${pageContext.request.contextPath }/admin/adminCategorySecond_findAllByPage.action?page=${csPageBean.page-1}">上一页</a>
		</c:if>
		<c:forEach begin="1" end="${csPageBean.totlePage}" var="i">
			<c:choose>
				<c:when test="${csPageBean.page!=i}">
					<a
						href="${ pageContext.request.contextPath }/admin/adminCategorySecond_findAllByPage.action?page=${i}">${i}</a>
				</c:when>
				<c:otherwise>
					<span class="currentPage">${i}</span>
				</c:otherwise>
			</c:choose>
		</c:forEach>
		<c:if test="${csPageBean.page!=csPageBean.totlePage}">
			<a
				href="${pageContext.request.contextPath }/admin/adminCategorySecond_findAllByPage.action?page=${csPageBean.page+1}">下一页</a> |
							<a
				href="${pageContext.request.contextPath }/admin/adminCategorySecond_findAllByPage.action?page=${csPageBean.totlePage}">尾页</a>
		</c:if>
	</div>
	<div align="center" style="color:red;"><h3>${error }</h3></div>
</body>
</HTML>

